package com.zboin.utils;

import com.zboin.domain.LoginUser;

public class UserUtil {

    private static final ThreadLocal<LoginUser> userCache = new ThreadLocal<>();

    /**
     * 获取当前登录的用户
     */
    public static LoginUser getLoginUser() {
       return userCache.get();
    }


    public static String getLoginUsername() {
        return getLoginUser().getUsername();
    }


    public static void setLoginUser(LoginUser loginUser) {
        userCache.set(loginUser);
    }


    public static void clearLoginUser() {
        userCache.remove();
    }
}
